/** 项目路由配置文件 */

import { KeepAlive } from "vue";
import { createRouter, createWebHashHistory } from "vue-router";


//路由表配置
const routesList = [
    {
        path:"/",
        redirect:"/home"
    },
    {
        path:'/home',
        name:"Home",
        component:()=>import("@/views/home/home.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/category",
        name:"Ctegory",
        component:() => import("@/views/category/category.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/cart",
        name:"Cart",
        component: () => import("@/views/cart/cart.vue"),
        meta:{
            keepAlive:false
        }
    },
    {
        path:"/mine",
        name:"Mine",
        component: () => import("@/views/mine/mine.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/search",
        name:"Search",
        component: () => import("@/views/search/search.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/detail",
        name:"productDetail",
        component: () => import("@/views/productDetails/productDetails.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/create",
        name:"createOrder",
        component: () => import ("@/views/createOrder/createOrder.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/orderDetail",
        name:"orderDetail",
        component:() => import("@/views/orderDetail/orderDetail.vue"),
        meta:{
            KeepAlive:true
        }
    },
    {
        path:"/orderlist",
        name:"orderList",
        component: () => import("@/views/orderList/orderList.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/payment",
        name:"Payment",
        component: () => import("@/views/payment/payment.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/user",
        name:"userInfo",
        component: () => import("@/views/userInfo/userInfo.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/setting",
        name:"setting",
        component: () => import("@/views/setting/setting.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/address",
        name:"address",
        component: () => import ("@/views/address/address.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/saveAddress",
        name:"SaveAddress",
        component: () => import ("@/views/saveAddress/saveAddress.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/login",
        name:"Login",
        component: () => import("@/views/login/login.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/register",
        name:"Register",
        component: () => import ("@/views/register/register.vue"),
        meta:{
            KeepAlive:false
        }
    },
    {
        path:"/forget",
        name:"Forget",
        component: () => import("@/views/forget/forget.vue"),
        meta:{
            KeepAlive:false
        }
    }
]

const router = createRouter({
    history:createWebHashHistory(),
    routes:routesList,
    scrollBehavior(){
        return {
            left:0,
            top:0
        }
    }
});

export default router;